#!/bin/bash

if [ $1 ]; then
  echo $1
  if [ $1 = 'celery' ]; then
    pipenv run celery -A standard.celery worker -l info
  elif [ $1 = 'celery_beat' ]; then
    pipenv run celery -A standard.celery beat -l info
  fi
else
  echo "default"
  pipenv run python manage.py makemigrations
  pipenv run python manage.py migrate
  export DJANGO_SUPERUSER_PASSWORD=myard@970704
  pipenv run python manage.py createsuperuser --noinput --username myard  --email myard@localhost.com
  pipenv run python manage.py collectstatic --noinput
  pipenv run gunicorn -w 2 -b 0.0.0.0:8000 standard.wsgi
fi
